import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../views/Layout/index.vue'
import customer from '@/router/customer.router.js'
import rider from '@/router/rider.router.js'



const Login = () => import('@/views/Login/Login.vue')
const Enroll = () => import('@/views/Login/Enroll.vue')
const addDish = () => import('@/views/others/addDish.vue')
const dishManage = () => import('@/views/Layout/backmanage/dishManage.vue')
const updateDish = () => import('@/views/others/updateDish.vue')
const orderDetail = () =>import('@/views/Layout/backmanage/orderDetail.vue')
const test = () =>import('@/views/others/test.vue')
const employee = () =>import('@/views/Layout/backmanage/employee.vue')
const updateEmployee = () =>import('@/views/others/updateEmployee.vue')
const classify = () =>import('@/views/Layout/backmanage/classify.vue')
const updateCategory = () =>import('@/views/others/updateCategory.vue')
const success = () =>import('@/views/Result/success.vue')
const fail = () =>import('@/views/Result/fail.vue')
const login1 = () =>import('@/views/chat/login.vue')
const main1 = () =>import('@/views/chat/main.vue')
const suppilerAllBack = () =>import('@/views/others/suppilerAllBack.vue')
const marketer = () =>import('@/views/Layout/backmanage/marketermanage.vue')
const addMarketer = () =>import('@/views/others/addMarketer.vue')
const updateMarketer = () =>import('@/views/others/updateMarketer.vue')

Vue.use(VueRouter)

const routes = [
  ...customer,
  ...rider,
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    children:[
      {
        path:'',
        name:'dishManage',
        component:dishManage,
        children:[
          {
            path:'updateDish',
            name:'updateDish',
            component:updateDish,
          }
        ]
      },
      {
        path:'orderDetail',
        name:'orderDetail',
        component:orderDetail
        
      },
      {
        path:'employeeManage',
        name:'employeeManage',
        component:employee,
        children:[
          {
            path:'updateEmployee',
            name:'updateEmployee',
            component:updateEmployee
          }
        ]
      },
      {
        path:'classify',
        name:'classify',
        component:classify,
        children:[
          {
            path:'updateCategory',
            name:'updateCategory',
            component:updateCategory
          }
        ]
      },
      {
        path:'marketermanage',
        name:'marketermanage',
        component:marketer,
        children:[
          {
            path:'addMarketer',
            name:'addMarketer',
            component:addMarketer
          },
          {
            path:'updateMarketer',
            name:'updateMarketer',
            component:updateMarketer
          }
        ]
      }
    ],

  },
  {
    path:'/login',
    name:'login',
    component:Login
  },
  {
    path: '/enroll',
    name:'enroll',
    component:Enroll
  },
  {
    path:'/addDish',
    name:'addDish',
    component:addDish
  },
  {
    path:'/test',
    name:'test',
    component:test
  },
  {
    path:'/success',
    name:'success',
    component:success
  },
  {
    path:'/fail',
    name:'fail',
    component:fail
  },
  {
    path:'/login1',
    name:'login1',
    component:login1
  },
  {
    path:'/main1',
    name:'main1',
    component:main1
  },{
    path:'/suppilerAllBack',
    name:'suppilerAllBack',
    component:suppilerAllBack
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
